<!DOCTYPE html>
<html lang="en"  xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>{$isAdd?'添加':'修改'}基础代码</title>
    <link rel="stylesheet" href="__PEAR__/component/pear/css/pear.css" />
</head>
<body>
<form class="layui-form" action="">
    <div class="mainBox">
        <div class="main-container">
            <div class="main-container">

                  <div class="layui-form-item">
				    <label class="layui-form-label">编号</label>
				    <div class="layui-input-inline">
				      <input type="text" name="code_id" value="{$one['code_id']}" required  lay-verify="required" placeholder="请输入唯一编号" autocomplete="off" class="layui-input">
				    </div>
				  </div>
				  
				  <div class="layui-form-item">
				    <label class="layui-form-label">名称</label>
				    <div class="layui-input-inline">
				      <input type="text" name="code_name" value="{$one['code_name']}" required  lay-verify="required" placeholder="请输入代码名称" autocomplete="off" class="layui-input">
				    </div>
				  </div>
				  
				  <div class="layui-form-item">
				    <label class="layui-form-label">英文名称</label>
				    <div class="layui-input-inline">
				      <input type="text" name="english_name" value="{$one['english_name']}" required  lay-verify="required" placeholder="请输入代码英文名称" autocomplete="off" class="layui-input">
				    </div>
				  </div>
				  
				  <div class="layui-form-item">
				    <label class="layui-form-label">备注</label>
				    <div class="layui-input-inline">
				      <input type="text" name="memo" value="{$one['memo']}" placeholder="" autocomplete="off" class="layui-input">
				    </div>
				  </div>
				  <input name="type" type="hidden" value="{$type}"/>
            </div>
        </div>
    </div>
    <div class="bottom">
        <div class="button-container">
            <button type="submit" class="pear-btn pear-btn-primary pear-btn-sm" lay-submit="" lay-filter="type-save">
                <i class="layui-icon layui-icon-ok"></i>
                提交
            </button>
            <button type="reset" class="pear-btn pear-btn-sm">
                <i class="layui-icon layui-icon-refresh"></i>
                重置
            </button>
        </div>
    </div>
</form>
<script src="__STATIC__/lib/layui/layui.js"></script>
<script src="__PEAR__/component/pear/pear.js"></script>
<script>
layui.use(['form','jquery'],function(){
    let form = layui.form;
    let $ = layui.jquery;
    var path="/{$MODULE_NAME}/Basecode/";
	var _url="/add";	
    form.on('submit(type-save)', function(data){
        $.ajax({
            url:path+_url,
            data:JSON.stringify(data.field),
            dataType:'json',
            contentType:'application/json',
            type:'post',
            success:function(result){
                if(result.code){
                    layer.msg(result.msg,{icon:1,time:1000},function(){
                        parent.layer.close(parent.layer.getFrameIndex(window.name));//关闭当前页
                        parent.layui.table.reload("basecode-table",{
							where:{'type_no':'{$type}'}
						});
                    });
                }else{
                    layer.msg(result.msg,{icon:2,time:1000});
                }
            }
        })
        return false;
    });
})
</script>
<script>
</script>
</body>
</html>